package com.example.usedcardealer;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;


public class MyDBHelper extends SQLiteOpenHelper {
    //常量定义
    public static final String name = "db_car1.db";
    public static final int DB_VERSION = 1;

    public static final String CREATE_USERDATA = "create table tb_Cars(cjh char(10)primary key,pp varchar(20),xh varchar(20),lx varchar(20))";
    //构造函数
    public MyDBHelper(Context context) {
        super(context, name, null, DB_VERSION);
    }
    @Override
    public void onCreate(SQLiteDatabase db) {
        db.execSQL(CREATE_USERDATA);//执行CREATE_USERDATA建表
        db.execSQL("insert into tb_Cars(cjh,pp,xh,lx)Values('123','honda','s2000','汽车');");

    }
    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
    }
}
